﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace System
{
    public static class DateTimeExtend
    {
        static string UserDateTimeFormat = "yyyy-MM-dd HH:mm:ss";

        public static string ToDateTimeStr(this DateTime date)
        {
            return date.ToString(UserDateTimeFormat);
        }

        public static DateTime toDate(this string dt)
        {
            DateTime result = DateTime.MinValue;
            DateTime.TryParse(dt, out result);
            return result;
        }
    }
}
